/**
 * QuestionChoiceController
 *
 * @description :: Server-side logic for managing questionchoices
 * @help        :: See http://sailsjs.org/#!/documentation/concepts/Controllers
 */

module.exports = {

		findOrDelete: function (req, res, next) {
		console.log('answer find or delete function is working as planned')
		var questionChoice = req.params.all()
		console.log(questionChoice);
		QuestionChoice.findOne({unique_id: questionChoice.unique_id})
		.exec(function findCb(err, found){
			if (err){console.log(err)}
			if (found){
				QuestionChoice.destroy({unique_id: questionChoice.unique_id})
				.exec(function cb(err, deleted){
					if (err){console.log(err)}
						console.log(deleted)
					//for (var i = 0; i < question.length; i++){
					//	QuestionChoice.
					//}
				res.status(200);
				res.json(deleted);
				})
			}
		})
	}
};

